﻿Imports Control_Vuelos_BL

Public Class frmsfrmAprobarManifiesto
    Inherits frmBaseMantenimiento

    ReadOnly vAprobarBL As New AprobarBL()

    Private Sub frmsfrmAprobarManifiesto_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AddHandler BarBtnGrabar.ItemClick, AddressOf prl_RegistroAprobar
        AddHandler BarBtnRefresh.ItemClick, AddressOf prl_RegistroActualizar
        BarBtnAgregar.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
        BarBtnCancelar.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
        BarBtnEliminar.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
        BarBtnImprimir.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
        BarBtnModificar.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
        BarBtnGrabar.LargeGlyph = Control_Vuelos_GUI.My.Resources.Resources.Arribos
        BarBtnGrabar.Caption = "Aprobar"
        prl_Refresh()
    End Sub

    Public Sub prl_Refresh()
        UcAprobar1.GridControl1.DataSource = vAprobarBL.pr_CargarListaManifiestoporAprobar(p_coduser).Tables("Vuelos")
        UcAprobar1.GridView1.SetRowExpanded(-1, True, True)
    End Sub

    Private Sub prl_RegistroAprobar()
        Dim Rows As New ArrayList()
        Rows.Add(UcAprobar1.GridView1.GetDataRow(UcAprobar1.GridView1.GetSelectedRows()(0)))
        Dim Row As DataRow = CType(Rows(0), DataRow)
        If Not Row Is Nothing Then
            vAprobarBL.pr_AprobarManifiesto(Row("codViaje").ToString())
        End If
        prl_Refresh()
    End Sub

    Private Sub prl_RegistroActualizar()
        prl_Refresh()
    End Sub
End Class